<HEAD>
  <SCRIPT SRC="../ganja.js"></SCRIPT>
</HEAD>
<BODY><SCRIPT>
// Create a Clifford Algebra with 3,1 metric for 2D CGA. 
Algebra(3,1,()=>{ 

// We don't work directly in the e3/e4 basis, but instead rotate it so we have
// two null vectors to work with (called origin and infinite)
  var ni = 1e4+1e3, no = 0.5*(1e4-1e3),
      point = (x,y)=>no + x*1e1 + y*1e2 + 0.5*(x*x+y*y)*ni;
  
// Rotator, Translator
  var translate = (v)=>(1-.5*v^ni),
      rotate    = (P,a)=>Math.cos(a/2) - Math.sin(a/2)*(1e12-P<<1e12^ni);
 
// Define a translation and a rotation and apply them to two points
  var tr = ()=>translate( Math.sin(performance.now()/1000)*1e1 ),
      ro = ()=>rotate(p1,performance.now()/1000)*tr,
      p1 = ()=>tr>>>point( 0, 0 ),
      p2 = ()=>ro>>>(point( 0.75, 0 ));
      
// Graph these items.
  document.body.appendChild(this.graph([
      p1,"tr>>>p1",                       // point 1
      p2,"rt>>>p2",                       // point 2
      ()=>[p1,p2],                        // segment from 1 to 2
      ()=>p1^p2^point(0,2,0)              // pretty circle
  ],{conformal:true,animate:true,grid:true}));
  
});
</SCRIPT></BODY>